package com.ybt.communicate.tcp.accessor.factory;

import com.ybt.communicate.tcp.accessor.IDataAccessStrategy;
import com.ybt.communicate.tcp.accessor.impl.LengthFixedAccessor;
import com.ybt.communicate.tcp.configration.TCPConstants;

public class DataAccessFactory {

    public static IDataAccessStrategy createDataAccess(String strategy,
            String charset) {

        if (strategy.startsWith(TCPConstants.FIX_LENGTH)) {
            // 定长读取策略
            return LengthFixedAccessor.newInstance(strategy
                    .substring(TCPConstants.FIX_LENGTH.length()), charset);
        }
        return null;
    }
}
